package com.ahzx.company.service.impl;

import com.ahzx.company.domain.CompanyInfo;
import com.ahzx.company.mapper.CompanyInfoMapper;
import com.ahzx.company.request.CompanyRequest;
import com.ahzx.company.service.CompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 企业信息业务实现层
 * @Author syg
 * @Date 2021/4/29 16:53
 * @Desc To be or not to be,that is a question.
 */
@Service
public class CompanyInfoServiceImpl implements CompanyInfoService {

    @Autowired
    private CompanyInfoMapper companyInfoMapper;

    @Override
    public List<CompanyInfo> selectCompanyInfoList(CompanyRequest companyRequest) {
        return companyInfoMapper.selectCompanyInfoList(companyRequest);
    }

    @Override
    public CompanyInfo selectCompanyInfoById(String id) {
        return companyInfoMapper.selectCompanyInfoById(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void deleteCompanyInfoById(String id) {
        companyInfoMapper.updateCompanyStatusById(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateCompanyInfoById(CompanyInfo companyInfo) {
        companyInfoMapper.updateCompanyInfoById(companyInfo);
    }
}
